package com.df.happylearn.articles;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.df.happylearn.R;
import com.df.happylearn.activity.BaseActivity;
import com.df.happylearn.messages.MessagesActivity;
import com.df.happylearn.utils.ActivityUtils;

/**
 * Created by dingfeng on 2016/5/24.
 */
public class ArticlesActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_acticles);
        findViewById(R.id.rlmessage).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ArticlesActivity.this, MessagesActivity.class);
                startActivity(intent);
            }
        });
        ArticlesFragment articlesFragment = (ArticlesFragment) getSupportFragmentManager().findFragmentById(R.id.frameContent);
        if (articlesFragment == null) {
            articlesFragment = ArticlesFragment.newInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), articlesFragment, R.id.frameContent);
        }
        new ArticlesPresenter(articlesFragment);
    }
}
